﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;
/// <summary>
/// TVoteUser 的摘要说明
/// </summary>
public class TVoteUser:TData
{
    //常量
  	const string CTableName="t_vote_user";
    const string CKeyName = "id";
    //与数据表字段对应的变量
    private string FId ; 
    private string FUserId ;
    private string FVoteId;
    private string FVoteItemId ; 
    private int FStatus ; 
    private decimal FSortNum ; 
    private string FInMan ; 
    private DateTime FInTime ; 
    private int FIId ; 

	public TVoteUser()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
        FTableName = CTableName;
        FKeyName = CKeyName;
	}
    public TVoteUser(string sid)
    {
    	FTableName = CTableName;
        FKeyName = CKeyName;
        FKeyValue = sid;
    }

       public override void Select()
    {
    	string strSql=GetSelectString();
    	TSqlDB oDB=new TSqlDB(strSql);
    	if(!oDB.EOF)
    	{
    		
            FId = oDB["Id"].ToString();
            FUserId = oDB["UserId"].ToString();
            FVoteId = oDB["VoteId"].ToString();
            FVoteItemId = oDB["VoteItemId"].ToString();
            FStatus = oDB["Status"].ToInt();
            FSortNum = oDB["SortNum"].ToDecimal();
            FInMan = oDB["InMan"].ToString();
            FInTime = oDB["InTime"].ToDateTime();
            FIId = oDB["IId"].ToInt();
    	}
    	oDB.Free();
    }
    //插入新记录。
    public void Insert()
    {
    	string ExSql ="'" +  FId + "','" + FUserId + "','" + FVoteId + "','" + FVoteItemId + "','" + FStatus + "','" + FSortNum + "','" + FInMan + "','" + FInTime + "'";
    	base.Insert(ExSql);
    }
    //更新记录。
    public void Update()
    {
    	string ExSql=" UserId ='" + FUserId + "', VoteId='" + FVoteId + "', VoteItemId ='" + FVoteItemId + "', Status ='" + FStatus + "', SortNum ='" + FSortNum + "', InMan ='" + FInMan + "', InTime ='" + FInTime + "'"; 
    	base.Update(ExSql);
    }
    //改变状态,0=未验证,1=已通过验证
    public void Update_status()
    {
        string ExSql = "status=" + FStatus.ToString(); ;
        base.Update(ExSql);
    }
    //静态，可以不用创建对象即可调用。
    public static void DeleteByID(string sID)
    {
        TData.DeleteByID(sID, CTableName, CKeyName);
    }
    
         
    public string Id
    {
        get
        {
            return FId;
        }
        set
        {
            FId = value;
        }
  } 
    public string UserId
    {
        get
        {
            return FUserId;
        }
        set
        {
            FUserId = value;
        }
  }
    public string VoteId
    {
        get
        {
            return FVoteId;
        }
        set
        {
            FVoteId = value;
        }
    }
    public string VoteItemId
    {
        get
        {
            return FVoteItemId;
        }
        set
        {
            FVoteItemId = value;
        }
  } 
    public int Status
    {
        get
        {
            return FStatus;
        }
        set
        {
            FStatus = value;
        }
  } 
    public decimal SortNum
    {
        get
        {
            return FSortNum;
        }
        set
        {
            FSortNum = value;
        }
  } 
    public string InMan
    {
        get
        {
            return FInMan;
        }
        set
        {
            FInMan = value;
        }
  } 
    public DateTime InTime
    {
        get
        {
            return FInTime;
        }
        set
        {
            FInTime = value;
        }
  } 
    public int IId
    {
        get
        {
            return FIId;
        }
        set
        {
            FIId = value;
        }
  }
}
